﻿<Window x:Class="WaveformLab.WaveWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:c="clr-namespace:Chart;assembly=Chart"
        Title="Waveform Lab" Height="350" Width="525" Icon="/WaveformLab;component/images/WaveformLab.ico" Closed="Window_Closed">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition  Height="Auto" />
            <RowDefinition  Height="Auto" />
            <RowDefinition  Height="*" />
        </Grid.RowDefinitions>

        <Menu Grid.Row='0' VerticalAlignment="Top" Height="24"  Margin="0,0,0,0">
            <MenuItem Header='_File'>
                <MenuItem Name="Open" Header="_Open" Click="MenuItem_Click" />
                <MenuItem Name="Save" Header="_Save" Click="MenuItem_Click" />
                <MenuItem Name="Exit" Header="_Exit" Click="MenuItem_Click" />
            </MenuItem>
            <MenuItem Header='_Function'>
                <MenuItem Name="FFT" Header="_FFT" Click="MenuItem_Click" />
                <MenuItem Name="F2F" Header="_F2F Decode" Click="MenuItem_Click" />
            </MenuItem>
            <MenuItem Header='_Help'>
                <MenuItem Name="Help" Header="_Support" Click="MenuItem_Click" />
                <MenuItem Name="Version" Header="_Version" Click="MenuItem_Click" />
            </MenuItem>
        </Menu>

        <StackPanel Grid.Row="1" >
            <StackPanel Height="24" Orientation="Horizontal" >
                <TextBlock Text="Device    " VerticalAlignment="Center" />
                <ScrollViewer Width="100" >
                    <ItemsControl IsTabStop="False" ItemsSource="{Binding Path=DeviceModules}" Width="100">
                        <ItemsControl.Resources>
                            <Style TargetType="{x:Type TextBlock}" x:Key="ModuleName">
                                <Setter Property="Margin" Value="2" />
                                <Style.Triggers>
                                    <Trigger Property="TextBlock.IsMouseOver" Value="true">
                                        <Setter Property="Background" Value="#10000000" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </ItemsControl.Resources>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <TextBlock x:Name="tbParent" Style="{StaticResource ModuleName}">
                                            <Hyperlink Focusable="False" Foreground="Black" TextDecorations="None" Command="{Binding Path=DataContext.ModuleDeviceSelectCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" CommandParameter="{Binding Path=ModuleId}" >
                                                <TextBlock Width="{Binding ElementName=tbParent, Path=ActualWidth, Mode=OneWay}" Text="{Binding Path=ModuleName}" />                                            
                                            </Hyperlink>
                                        </TextBlock>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>
                <TextBlock Text="    Application    " VerticalAlignment="Center" />
                <ScrollViewer  Width="100" >
                    <ItemsControl IsTabStop="False" ItemsSource="{Binding Path=ApplicationModules}" Width="100">
                        <ItemsControl.Resources>
                            <Style TargetType="{x:Type TextBlock}" x:Key="ModuleName">
                                <Setter Property="Margin" Value="2" />
                                <Style.Triggers>
                                    <Trigger Property="TextBlock.IsMouseOver" Value="true">
                                        <Setter Property="Background" Value="#10000000" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </ItemsControl.Resources>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <TextBlock x:Name="tbParent" Style="{StaticResource ModuleName}">
                                            <Hyperlink Focusable="False" Foreground="Black" TextDecorations="None" Command="{Binding Path=DataContext.ModuleApplicationSelectCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" CommandParameter="{Binding Path=ModuleId}" >
                                                <TextBlock Width="{Binding ElementName=tbParent, Path=ActualWidth, Mode=OneWay}" Text="{Binding Path=ModuleName}" />                                            
                                            </Hyperlink>
                                        </TextBlock>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>
            </StackPanel>
            <Border BorderBrush="Transparent" BorderThickness="1" Height="10" HorizontalAlignment="Left" VerticalAlignment="Top" />
        </StackPanel>
        
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition  Width="310" />
                <ColumnDefinition  Width="5" />
                <ColumnDefinition  Width="*" />
            </Grid.ColumnDefinitions>

            <ScrollViewer Grid.Column="0" VerticalScrollBarVisibility="Auto">
                <StackPanel Name="PanelGrid"  CanVerticallyScroll="True">
                    <ContentControl x:Name="ModuleDeviceContainer" />
                    <ContentControl x:Name="ModuleApplicationContainer" />
                </StackPanel>
            </ScrollViewer>
            <GridSplitter  Width="5" Grid.Column="1" />
            <Grid Grid.Column="2">
                <Grid.RowDefinitions>
                    <RowDefinition  Height="*" />
                    <RowDefinition  Height="50" />
                </Grid.RowDefinitions>
                <Grid Name="GraphGrid"  Grid.Row="0" >
                    <c:ChartControl   Name="Graph" Grid.Column="2" Width="{Binding ElementName=GraphGrid, Path=ActualWidth}" Height="{Binding ElementName=GraphGrid, Path=ActualHeight}" MinWidth="100" MinHeight="100" />
                </Grid>
                <Grid Name="ConsoleGrid" Grid.Row="1"  Width="{Binding ElementName=GraphGrid, Path=ActualWidth}" Height="{Binding ElementName=GraphGrid, Path=ActualHeight}">
                    <TextBox  Name="textBoxConsole" AcceptsReturn="True" AllowDrop="False" TextWrapping="Wrap" />
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</Window>
